<?php

$title = '';
$descript = '';
$date = '';
$time = '';
$url = '';
$id = 0;

if (!isset($event)){
	echo heading('New Event', 1);
} else {
	echo heading('Edit Event', 1);
	$title = $event['title'];
	$descript = $event['description'];
	$date = $event['date'];
	$time = $event['time'];
	$url = $event['url'];
	$id = $event['id'];
}

echo validation_errors('<p class="error">', '</p>');

if (isset($event)){
	echo form_open('calendar/change');
	echo form_hidden('id', set_value('id', $id));
} else {
	echo form_open('calendar/create_event');
}

echo form_label('Event Name: ');
echo form_input('title', set_value('title', $title)) .br(1);
echo form_label('Date (yyyy-mm-dd) : ');
echo form_input('date', set_value('date', $date)) .br(2);
echo form_label('Time (optional) : ');
echo form_input('time', set_value('time'), $time) .br(2);

$attr = array(
	'rows' => 10,
	'cols' => 60,
	'name' => 'description' );

echo form_textarea($attr, set_value('description', $descript)) .br(1);

echo form_label('Event Link: ');
echo form_input('url', set_value('url', $url));

echo form_submit('submit', 'Post');

?>